<?php

abstract class adminControl
{
	protected $db;
	protected $data;
	protected $basename;
	
	protected $config;
	
	public function __construct()
	{
		global $action, $db;
		$this->db = $db;
		$this->config = $GLOBALS['very'];
		$this->basename = $GLOBALS['basename'];
		
		$this->fillData('basename', $GLOBALS['basename']);
		$this->fillData('action', $action);
		$this->fillData('very', $GLOBALS['very']);
		
		if ($_SERVER['REQUEST_METHOD'] == 'POST')
		{
			$function = 'post' . $action . 'Action';
		}
		else 
		{
			$function = empty($action) ? 'indexAction' : 'get' . $action . 'Action';
		}
		
		if (method_exists($this, $function))
		{
			$this->$function();
		}
		else 
		{
			Showmsg('非法操作，不存在的管理操作');
		}
	}
	
	protected function fillData($key, $val)
	{
		$this->data[$key] = $val;
	}
	
	protected function display($tplname)
	{
		foreach ($this->data as $key => $val)
		{
			$$key = $val;
		}
		require PrintEot('header');
		require PrintEot($tplname);
		adminbottom();
	}
	
}
?>